package com.py.pythink.controller;

import com.py.pythink.bo.UserDetailAddBo;
import com.py.pythink.config.SystemConfig;
import com.py.pythink.service.intf.UserDetailService;
import com.py.pythink.vo.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@RestController
@RequestMapping("/api/userdetail/")
@CrossOrigin
@Api(value = "",tags = "用户详情接口修改个人信息，查询个人信息，更换头像")
public class UserDetailController {
    @Autowired
    private UserDetailService service;

    @PostMapping("init.do")
    public R init(@RequestBody UserDetailAddBo bo) throws IOException {
        return service.init(bo);
    }
    @PostMapping("changeheader.do")

    public R change(int uid,int oid){
        return service.changeHeader(uid, oid);
    }
    @GetMapping("detail.do")
    public R detail(HttpServletRequest request){
        return service.queryDetails(request.getHeader(SystemConfig.USER_TOKEN));
    }

}
